package edu.mit.compilers.lowercode;

import edu.mit.compilers.lowercode.code.ThreeAddressCodeList;
import edu.mit.compilers.utils.Showable;

import java.util.HashMap;

public class ThreeAddressCodesInfo implements Showable {
    public SymbolTable symbolTable = new SymbolTable();
    public HashMap<String, ThreeAddressCodeList> method2Codes = new HashMap<>();

    public String show(boolean debug) {
        assert symbolTable != null && method2Codes != null;
        StringBuilder builder = new StringBuilder();
        builder.append(symbolTable.show());

        for (ThreeAddressCodeList codes : method2Codes.values()) {
            builder.append(codes.show(debug));
        }
        return builder.toString();
    }
}
